<template>
  <v-chart ref="chart" class="chart" :option="option" />
</template>

<script>
export default {
  name: 'PieChart3',
  props: ['rData'],
  data() {
    return {
      option: {
        color: ['#007AFF', '#5ac7a9', '#85C89D', '#f7c241', '#e06d67', '#85C89D', '#fc8452', '#9a60b4', '#ea7ccc'],
        legend: {
          right: 'right',
          top: 'center'
        },
        title: {
          text: '\xa0两院\n院士分布',
          left: 'center',
          top: 'center',
          textStyle: {
            fontSize: 14
          }
        },
        tooltip: {
          trigger: 'item'
        },
        series: [
          {
            type: 'pie',
            radius: [50, 80],
            center: ['center', 'center'],
            startAngle: 180,
            label: {
              formatter: (params) => {
                return Math.round(params.percent) + '%' + '\n' + params.name
              }
            },
            labelLine: {
              showAbove: true,
              minTurnAngle: 90
            },
            data: [
              { value: 40, name: '中国科学院院士' },
              { value: 38, name: '中国工程院院士' }
            ]
          }
        ]
      }
    }
  },
  methods: {
    resize() {
      this.$refs['chart'].resize()
    }
  }
}
</script>

<style>

</style>
